package cn.wk.org.service.impl;

import cn.wk.basic.service.impl.BaseServiceImpl;
import cn.wk.basic.utils.AjaxResult;
import cn.wk.org.domain.Employee;
import cn.wk.org.mapper.EmployeeMapper;
import cn.wk.org.service.IEmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class EmployeeServiceImpl extends BaseServiceImpl<Employee> implements IEmployeeService {
    @Autowired
    private EmployeeMapper employeeMapper;

    @Override   //查询所有管理者
    public List<Employee> findManager() {
        return employeeMapper.findManager();
    }

    @Override   //根据用户名和密码查询
    public Employee findByName(Employee employee) {
        Employee byName = employeeMapper.findByName(employee);
        return byName;
    }

    /**
     * 传入logininfo id 然后找到emp
     * @param id
     * @return
     */
    @Override
    public AjaxResult findByLogininfoId(Long id) {
        Long byLogininfoId = employeeMapper.findByLogininfoId(id);
        if(byLogininfoId != null){
            return new AjaxResult("no");
        }
        return new AjaxResult();
    }
}
